<?php
namespace app\school\validate\school;

use think\Validate;

/**
 * 机构验证
 */
class School extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [

        'title'                 => 'require',
        'category'              => 'require',
        'logo'                  => 'require|integer',
        'intro'                 => 'require',
        'telephone'             => 'require|number',
        'address'               => 'require',
        'legal_IDcard'          => 'require|idCard',
        'legal_IDcard_positive' => 'require|integer',
        'legal_IDcard_side'     => 'require|integer',
        'business_license'      => 'require|integer',
    ];

    protected $field = [
        'title'                 => '机构名称',
        'category'              => '机构分类',
        'logo'                  => '机构LOGO',
        'intro'                 => '机构简介',
        'telephone'             => '联系电话',
        'address'               => '联系地址',
        'legal_IDcard'          => '法人身份证号码',
        'legal_IDcard_positive' => '法人身份证正面附件',
        'legal_IDcard_side'     => '法人身份证反面附件',
        'business_license'      => '营业执照附件',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
        'course_type.require' => '参数为空',
        'course_type.in'      => '参数错误',

    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'auth' => [
            'title',
            'category',
            'logo',
            'intro',
            'telephone',
            'address',
            'legal_IDcard',
            'legal_IDcard_positive',
            'legal_IDcard_side',
            'business_license',
        ],
    ];

}
